package com.xishu;

import com.xishu.config.Config;
import com.xishu.config.Constant;
import com.xishu.entity.order.Order;
import com.xishu.entity.order.OrderPayTypeMapping;
import com.xishu.entity.shop.Item;
import com.xishu.service.CommonService;
import com.xishu.service.ShopSearchItemService;
import com.xishu.task.InitTask;
import com.xishu.upgrade.UpgradeItemService;
import com.xishu.upgrade.UpgradeOrderService;
import com.xishu.upgrade.UpgradeService;
import org.apache.logging.log4j.ThreadContext;
import org.springframework.boot.SpringApplication;

public class StartApplication {
    public static void main(String[] args) throws Exception {
        SpringApplication.run(AppConfig.class);
        ThreadContext.put(Constant.REQUEST_ID, "start application");

        if (!Config.getInstance().isLocalNode()) {
            InitTask.getInstance().init();
            //初始化地址，每次都调用
            InitTask.getInstance().initArea();
            InitTask.getInstance().updateItemCatalogName();
            InitTask.getInstance().updateSceneConfig();

            InitTask.getInstance().insertCompanyMainItem();
        }

        InitTask.getInstance().intOrderNoService();
        //升级
        UpgradeService.getInstance().upgrade();
        //初始化报表查询字段
        ShopSearchItemService.getInstance().init();

    }
}
